<div class="Item hr">
    <span class="fr">现有栏目<b>{$rows_count}</b>个 <button class="btn add_oper" >添加栏目</button></span>
    <div class="current">栏目列表</div>
</div>
<form>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
        <thead>
            <tr>
                <td>栏目名称</td>
                <td>导航显示</td>
                <td>页面类型</td>
                <td>排序</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <volist name="categorys" id="cate">
            <tr >
                <td>{$cate['name']}</td>
                <td>
                    <if condition="$cate['is_show'] eq 1"><img src="__PUBLIC__/images/admin/ok.gif" /></if>
                    <if condition="$cate['is_show'] eq 2"><img src="__PUBLIC__/images/admin/error.gif" /> </if>
                </td>
                <td>
                    <if condition="$cate['page_type'] eq 1">单页面</if>
                    <if condition="$cate['page_type'] eq 2">多页面</if>
                </td>
                <td>
                    {$cate['sort']}
                </td>
                <td>
                    [ <a href="{:U('Category/edit', array('id' => $cate['id']))}">编辑</a> ]
                    <if condition="$cate['static_type'] neq 1">
                    [ <a href="javascript:void(0);" value="{:U('Category/delete', array('id' => $cate['id']))}"  class="del">删除</a> ]
                    </if>
                </td>
            </tr>
                <volist name="cate['subCategorys']" id="subCate">
                    <tr >
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;|--{$subCate['name']}</td>
                    <td>
                        <if condition="$subCate['is_show'] eq 1"><img src="__PUBLIC__/images/admin/ok.gif" /></if>
                        <if condition="$subCate['is_show'] eq 2"><img src="__PUBLIC__/images/admin/error.gif" /> </if>
                    </td>
                    <td>
                        <if condition="$subCate['page_type'] eq 1">单页面</if>
                        <if condition="$subCate['page_type'] eq 2">多页面</if>
                    </td>
                        <td>
                            {$subCate['sort']}
                        </td>
                    <td>
                        [ <a href="{:U('Category/edit', array('id' => $subCate['id']))}">编辑</a> ]
                        <if condition="$cate['static_type'] neq 1">
                        [ <a href="javascript:void(0);" value="{:U('Category/delete', array('id' => $subCate['id']))}"  class="del">删除</a> ]
                        </if>
                    </td>
                    </tr>
                </volist>
            </volist>
        </tbody>
    </table>
</form>

<div class="page">
    {$page}
</div>
<script type="text/javascript">
    $(function(){
        $(".del").click(function(){
            var del_link = $(this).attr("value");
            popup.confirm('确定删除？','温馨提示',function(action){
                if(action == 'ok'){
                    $.getJSON(del_link, function(json){
                        if (json.status) {
                            popup.success(json.info);
                            setTimeout(function(){
                                popup.close("asyncbox_success");
                            },2000);
                        } else {
                            popup.error(json.info);
                            setTimeout(function(){
                                popup.close("asyncbox_error");
                            },2000);
                        }

                        setTimeout(function(){
                            top.window.location.reload();
                        },1000);
                    });
                }
            });

            return false;
        });

        $(".add_oper").click(function(){
            location.href="{:U('Category/add')}"
        });
    });
</script>